MPT.addAction("profile", function(_elm) {
    //基本信息
    var basicInfo_jQ = $('.e_basicinfo', _elm);
    var basicInfo = {
        sex_jQ: $('.e_sex', basicInfo_jQ),          //性别
        birth_jQ: $('.e_birth', basicInfo_jQ),       //生日
        liveCity_jQ: $('.e_liveCity', basicInfo_jQ), //城市
        homeCity_jQ: $('.e_homeCity', basicInfo_jQ) //家乡	
    }

	//游戏信息
	var gameInfo_jQ = $('.e_gameinfo',_elm);
	var gameInfo = {
		area_jQ : $('.e_area',gameInfo_jQ),   //区服
		career_jQ : $('.e_career',gameInfo_jQ), //职业
		school_jQ : $('.e_school',gameInfo_jQ), //门派
		gangs_jQ : $('.e_gangs',gameInfo_jQ) //帮会	
	}
	
	//个人信息
	var selfInfo_jQ = $(".e_selfinfo",_elm);
	var selfInfo = {
		star_jQ : $('.e_star',selfInfo_jQ),   //星座
		blood_jQ : $('.e_bloodtype',selfInfo_jQ), //血型
		love_jQ : $('.e_love',selfInfo_jQ),   //感情
		idol_jQ : $('.e_idol',selfInfo_jQ),   //偶像
		wish_jQ : $('.e_wish',selfInfo_jQ),   //心愿
		motto_jQ : $('.e_motto',selfInfo_jQ), //座右铭
		music_jQ : $('.e_music',selfInfo_jQ), //喜欢音乐
		hobby_jQ : $('.e_hobby',selfInfo_jQ), //兴趣爱好
		introduction_jQ : $('.e_introduction',selfInfo_jQ) //个人介绍
	}
	
	//联系方式
	var relateInfo_jQ = $(".e_relateinfo",_elm);
	var relateInfo = {
		qq_jQ : $('.e_qq',relateInfo_jQ), // QQ
		phone_jQ : $('.e_phone',relateInfo_jQ), //手机
		site_jQ : $('.e_site',relateInfo_jQ) // 个人网站
	}
	
	//信息结点
	var info = {
			'basicInfo' : basicInfo,
			'gameInfo' : gameInfo,
			'selfInfo' : selfInfo,
			'relateInfo' : relateInfo
	}
	
	//完整度结点
	var precent_jQ = $('.e_precent',_elm);
	
	//计算完整度
	var progress = function(){
		var total = 0;
		var hasValue = 0;
		for(var infoname in info){
			for(var infojQ in info[infoname]){
				total++;
				info[infoname][infojQ].text() && hasValue++;
			}
		}
		var precent = Math.round(hasValue/total*100);
		var precentStr = precent+'%';
		precent_jQ.find('em').text(precentStr);
		precent_jQ.find('strong').css('width',precentStr);
	}
	
	//初始化信息
	var initialize = function(_areaList){
		//得到用户的信息
		Backend.findUserData('',
		  function(_resp){
				if(Backend.dataValidate(_resp)){
					var data = _resp.data;
					//初始化生日
					basicInfo.birth_jQ.text(data.birthday ? (data.birthday.substr(0,4)+'-'+data.birthday.substr(4,2)+'-'+data.birthday.substr(6,2)) : '' );
					//初始化地区
					var homeCity = '';
					if(data.hometownCityId){
						if(province_city_map.city[data.hometownCityId])
							homeCity = province_city_map.city[data.hometownCityId].name;
						else if(province_city_map.province[data.liveCityId])
							homeCity = province_city_map.province[data.hometownCityId].name;
					}
					basicInfo.homeCity_jQ.text(homeCity);
					var liveCity = '';
					if(data.liveCityId){
						if(province_city_map.city[data.liveCityId])
							liveCity = province_city_map.city[data.liveCityId].name;
						else if(province_city_map.province[data.liveCityId])
							liveCity = province_city_map.province[data.liveCityId].name;
					}
					basicInfo.liveCity_jQ.text(liveCity);
					//初始化性别
					basicInfo.sex_jQ.text(data.sex || '');
					
					
					//初始化大区
					gameInfo.area_jQ.text(data.area ? _areaList[data.area] : '');
					//初始化职业
					gameInfo.career_jQ.text(data.userProfession ? SiteUtil.getGangDicts()[data.userProfession ] : '');
					//初始化门派
					gameInfo.school_jQ.text(data.gangDictId ? SiteUtil.getGangDicts()[data.gangDictId ] : '')
					//初始化帮会
					gameInfo.gangs_jQ.text(data.gameGang || '');
					
					
					//初始化星座
					selfInfo.star_jQ.text(data.constellation ? SiteUtil.getConstellations()[data.constellation] : '');
					//初始化血型
					selfInfo.blood_jQ.text(data.bloodType ? SiteUtil.getBloods()[data.bloodType] : '');
					//初始化感情  
					selfInfo.love_jQ.text(data.loveStatus ? SiteUtil.getLoveStatus()[data.loveStatus] : '');
					//初始化偶像  
					selfInfo.idol_jQ.text( data.idol || '');
					//初始化心愿  
					selfInfo.wish_jQ.text(data.wish || '');
					//初始化座右铭 
					selfInfo.motto_jQ.text(data.motto || '');
					//初始化喜欢音乐
					selfInfo.music_jQ.text(data.enjoyMusic || '');
					//初始化兴趣爱好
					selfInfo.hobby_jQ.text(data.hobby || '');
					//初始化个人介绍
					selfInfo.introduction_jQ.text(data.introductions || '');
					
					
					//初始化qq
					relateInfo.qq_jQ.text(data.userQq || '');
					//初始化手机
					relateInfo.phone_jQ.text(data.mobile || '');
					//初始化主页
					relateInfo.site_jQ.text(data.homePage || '');
				}
				//计算完整度
				progress();
		});
	}
	
	
	
	//得到大区信息
	SiteUtil.getServerZone(function(_areaList){
		//得到城市信息
		SiteUtil.getRegion(function(){
			initialize(_areaList);
		});
	});
	
});